package cn.tannn.surenessdemo.user.service;

import cn.hutool.core.lang.tree.Tree;
import cn.tannn.surenessdemo.user.entity.AuthRoute;

import java.util.List;
import java.util.Optional;

/**
 * 前端路由
 *
 * @author tnnn
 * @version V1.0
 * @date 2022-07-28 09:06
 */
public interface AuthRouteService {

    /**
     * 新增路由
     * @param authRoute authRoute
     * @return boolean
     */
    boolean addAuthRoute(AuthRoute authRoute);

    /**
     * 修改路由
     * @param authRoute authRoute
     * @return boolean
     */
    boolean updateAuthRoute(AuthRoute authRoute);

    /**
     * 删除路由
     * @param routeCodes 路由code
     * @return boolean
     */
    boolean deleteAuthRoute(List<String> routeCodes);

    /**
     * 获取所有路由
     * @return  List of AuthRoute
     */
    List<AuthRoute> getAuthRoutes();


    /**
     * 获取所有路由
     * @return  List of AuthRoute
     */
    Optional<List<AuthRoute>> getAuthRoutesOp();


    /**
     * 获取此角色拥有的路由
     * @param roleCode role code
     * @return List of AuthRoute
     */
    List<AuthRoute> getRouteOwnRole(String roleCode);



    /**
     * 获取资源对应的路由
     * @param resourceCode 资源 code
     * @return List of AuthRoute
     */
    List<AuthRoute> getRouteByResource(String resourceCode);

    /**
     * 根据用户code查询用户路由
     * @param userCode userCode
     * @return AuthRoute
     */
    List<AuthRoute> userRoute(String userCode);



    /**
     * 根据用户code查询用户路由
     * @param userCode userCode
     * @return AuthRoute
     */
    List<Tree<String>> userRouteTrue(String userCode);



    /**
     * 根据用户code查询用户路由
     * @param authRoute 路由实体
     * @return AuthRoute
     */
    List<Tree<String>> routeTrue(List<AuthRoute> authRoute);

}
